<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "{{%campaign}}".
 *
 * @property integer $id
 * @property string $name
 * @property integer $advertiser_id
 * @property integer $label_id
 * @property string $start_date
 * @property string $end_date
 * @property integer $type
 * @property string $total_budget
 * @property string $day_budget
 * @property integer $frequency_control
 * @property integer $frequency_control_type
 * @property integer $frequency_upper_limit
 * @property integer $frequency_lower_limit
 * @property string $frequency_lower_start
 * @property integer $status
 * @property integer $creator
 * @property string $creator_name
 * @property string $last_update
 */
class Campaign extends \app\models\BaseAR
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%campaign}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['name', 'advertiser_id', 'start_date'], 'required'],
            [['advertiser_id', 'label_id', 'type', 'frequency_control', 'frequency_control_type', 'frequency_upper_limit', 'frequency_lower_limit', 'status', 'creator'], 'integer'],
            [['start_date', 'end_date', 'frequency_lower_start', 'last_update'], 'safe'],
            [['total_budget', 'day_budget'], 'number'],
            [['name'], 'string', 'max' => 128],
            [['creator_name'], 'string', 'max' => 64],
            [['advertiser_id', 'name'], 'unique', 'targetAttribute' => ['advertiser_id', 'name'], 'message' => 'The combination of Name and Advertiser ID has already been taken.']
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'name' => 'Name',
            'advertiser_id' => 'Advertiser ID',
            'label_id' => 'Label ID',
            'start_date' => 'Start Date',
            'end_date' => 'End Date',
            'type' => 'Type',
            'total_budget' => 'Total Budget',
            'day_budget' => 'Day Budget',
            'frequency_control' => 'Frequency Control',
            'frequency_control_type' => 'Frequency Control Type',
            'frequency_upper_limit' => 'Frequency Upper Limit',
            'frequency_lower_limit' => 'Frequency Lower Limit',
            'frequency_lower_start' => 'Frequency Lower Start',
            'status' => 'Status',
            'creator' => 'Creator',
            'creator_name' => 'Creator Name',
            'last_update' => 'Last Update',
        ];
    }
}
